<template>
  <div :class="[$style.container]">
    <div :class="[$style.logoBox]">
      <el-avatar :size="32" src="/logo.png"></el-avatar>
      <span :class="[$style.title]">{{title}}</span>
    </div>
    <div>
      <div>
        <app-setting></app-setting>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { AppModule } from '@/store'
import { expr } from '@/utils/url'
import { Component, Prop, Vue } from 'vue-property-decorator'
import AppSetting from '@/views/components/app-setting/index.vue'

@Component({
  components: { AppSetting }
})
export default class CommonHeader extends Vue {
  @Prop(Boolean) profile!: boolean

  @Prop({ type: String, default: '账号中心' }) title!: string

  @AppModule.State properties!: any

  onLogout () {
    this.$auth.logout()
    this.$router.push('/login')
  }

  onGoDoc () {
    location.replace(expr(this.properties?.deploy?.documentWeb))
  }
}
</script>

<style lang="scss" module>
@import "~@/styles/vars.scss";

$header-height: 48px;

.container {
  display: flex;
  align-items: center;
  height: 48px;
  justify-content: space-between;
  padding: 0 16px;
  background-color: $bg-color;
}

.logoBox {
  display: flex;
  align-items: center;
}

.title {
  margin-left: 8px;
  font-size: 16px;
  color: $text-regular-color;
}
</style>
